package Practice02;

import java.util.Random;
import java.util.Scanner;

//猜数字
public class Guessing {
    public static void main(String[] args) {
        Random random = new Random();
        Scanner scanner = new Scanner(System.in);
        int num = random.nextInt(100);
        System.out.println("答案是:" + num);
        System.out.println("开始");
        while (true) {
            int guess = scanner.nextInt();
            if (guess>num) {
                System.out.println("猜大了");
            }
            else if (guess<num) {
                System.out.println("猜小了");
            }
            else {
                System.out.println("恭喜你猜对了");
                break;
            }


        }

    }
}
